<?php
error_reporting(0);
define('IN_QY',true);
session_start();
require("include/common.inc.php");
define('SCRIPT','ad_list');
?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>发货中心-众晒网</title>
   
    <link rel="stylesheet" href="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <link rel="stylesheet" type="text/css" href="/ui/css/Hui.css" />
     <script type="text/javascript" src="/ui/script/H.js"></script>
<script src="https://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
	<script type="text/javascript" src="/ui/layer/mobile/layer.js"></script> 
   
<script type="text/javascript" language="javascript">   
$(document).ready(function () {   
    select_input("a","date");   
});   
//下拉输入框架   
function select_input(tag,nature){   
    $(tag+"["+nature+"]").each(function(i,item){   
        var a_attr=$(item).attr(nature).split(",");   
        var _this=$(this);   
        var o_select=a_attr[0];   
        var t_name  =a_attr[1];   
        var i_width=_this.width()+2;   
        var i_w=$(o_select).width();   
        i_width=i_width>i_w?i_width:i_w;   
        $(o_select).css({width:i_width,left:"-1px",display:"none"});   
        _this.keyup(function(){   
            var v=$(this).find("input.select_input").val();   
            if(v==""){   
                $(o_select+" li").show();   
            }else{   
                $(o_select+" li").hide();   
                $(o_select+" li:contains('"+v+"')").show();   
            }   
        });   
        _this.click(function(e){   
            $(this).blur();   
            $(".select_ul_list").hide();   
            $(".select_a").css("z-index",10);   
            $(this).css("z-index",11);   
            $(o_select+" li").show();   
            $(o_select).fadeIn();   
            e.stopPropagation();   
        });   
        $(o_select+" li").click(function(e){   
            _this.find("input.select_input").val($(this).text());   
            if(t_name!=""){   
                _this.find("input[name='"+t_name+"']").val($(this).val());   
            }   
            $(o_select).fadeOut();   
            e.stopPropagation();   
        });   
        $(document).click(function(){   
            $(".select_ul_list").fadeOut();   
        });   
        $(".select_ul_list li").hover(function(){   
            $(this).addClass("on_select_ul_li");   
        },function(){   
            $(this).removeClass();   
        });   
    });   
}   
</script>

<style type="text/css">
        body {
            font-size: 12px;
            margin: 0;
           
            text-align: left;
        }
        #out{
            margin: 100px auto;
            width:700px;
            text-align: left;
        }
        ul,li{margin: 0;padding: 0;list-style: none;}
        .div label {
            color: #333;
            line-height:30px;
            width: 100px;
            display: inline-block;
            text-align: right;
            padding-right: 5px;
            font-weight: bold
        }

            
        .select_a{
            border:0;
            height:26px;
            text-decoration: none;
            outline:none;
            position: relative;
            display: inline-block;
            background: url(select.jpg) repeat-x scroll right top;
            z-index: 10;
        }
        .select_a:hover{background-position: right bottom;}
        .select_input{
            height:25px;
            width:94px;
            line-height: 25px;
            margin-right:22px;
            padding-left:2px;
            border:none;
            color:#369;
            outline: none;
            background: url(select_input.jpg) repeat-x scroll left top;
        }
        .select_ul_list{
            position: absolute;
            display: none;
            top:26px;
            z-index: 100;
            max-height: 250px;
            overflow: auto;
            border-bottom:0;
            width: 140px;
            text-align: left;
        }
        .select_ul_list li{
            font-size: 12px;
            line-height:20px;
            color:#666;
            height:22px;
            line-height: 22px;
            padding: 0 2px;
            cursor: pointer;
            border:0;
            border-bottom: none;
            
            white-space:nowrap;
        }
        .select_ul_list .on_select_ul_li{
            background-color: #3897EE;
            color: #fff
        }
        #input_list {
    height: 90px;
}
.ui-popup-container{
    width: 80%;
}
.table{
    margin: 0 auto;
}
.ui-page-theme-a .ui-btn, html .ui-bar-a .ui-btn, html .ui-body-a .ui-btn, html body .ui-group-theme-a .ui-btn, html head+body .ui-btn.ui-btn-a, .ui-page-theme-a .ui-btn:visited, html .ui-bar-a .ui-btn:visited, html .ui-body-a .ui-btn:visited, html body .ui-group-theme-a .ui-btn:visited, html head+body .ui-btn.ui-btn-a:visited{
   background: #cccccc00;
    border-radius: 7px;
    border: 1px solid #828282;
    margin: 11px;
    font-size: 12px;
    width: 70px;
}
.ui-btn ui-btn-inline ui-corner-all{
    width: 70px;
}
button {
    
}
button, html [type="button"], [type="reset"], [type="submit"] {
    -webkit-appearance: button;
}
button, select {
    text-transform: none;
}
button, input {
    overflow: visible;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
button, input, select, textarea {
    font: inherit;
    margin: 0;
}

.ui-btn {
    padding: 0;
    display: initial;
    position: relative;
    text-align: center;
}
.ui-page-theme-a .ui-btn:focus, html .ui-bar-a .ui-btn:focus, html .ui-body-a .ui-btn:focus, html body .ui-group-theme-a .ui-btn:focus, html head+body .ui-btn.ui-btn-a:focus, .ui-page-theme-a .ui-focus, html .ui-bar-a .ui-focus, html .ui-body-a .ui-focus, html body .ui-group-theme-a .ui-focus, html head+body .ui-btn-a.ui-focus, html head+body .ui-body-a.ui-focus{
    border-color: #ffa200;
    border-radius: 5px;
    outline: none;
    color: #ffa200;
    background-color: rgba(204, 204, 204, 0);
    box-shadow: 0 0 12px #38c0;
}
    </style>
 <style type="text/css">
    .H-theme-background-color9 {
    background-color: #ffffff;
}
.H-theme-font-color-white {
    color: black;
}
.H-theme-border-color9 {
    border: 1px solid #ffa200;
}
.H-theme-font-color9 {
    color: #ffa200;
}

:focus {
    border-color: #ffa200;
    border-radius: 5px;
    outline: none;
    color:  #ffa200;
}
div#list1 {
    border-radius: 8px;
}
.ui-page.ui-page-theme-a.ui-page-active {
    background: #f4f5f9;
}
.ui-page-theme-a .ui-btn:focus, html .ui-bar-a .ui-btn:focus, html .ui-body-a .ui-btn:focus, html body .ui-group-theme-a .ui-btn:focus, html head+body .ui-btn.ui-btn-a:focus, .ui-page-theme-a .ui-focus, html .ui-bar-a .ui-focus, html .ui-body-a .ui-focus, html body .ui-group-theme-a .ui-focus, html head+body .ui-btn-a.ui-focus, html head+body .ui-body-a.ui-focus {
    box-shadow: 0 0 12px rgba(51, 136, 204, 0);
}
ul#input_list{
    background: #f3f3f3e8;
    background-color: rgba(243, 243, 243, 0.91);
}
.ui-mobile label, .ui-controlgroup-label {
    display: block;
    margin: 0;
}
.ui-mobile label, div.ui-controlgroup-label {
    font-size: 15px;
}
    </style>

</head>
<body id="body">
    <header class="H-header H-theme-background-color9" id="header">
        <span tapmode="" onclick="H.closeWin();" class="H-icon H-position-relative H-display-inline-block H-float-left H-vertical-middle H-theme-font-color-white H-padding-horizontal-left-5 H-z-index-100"><i class="H-iconfont H-icon-arrow-left H-font-size-18 H-vertical-middle"></i><label class="H-display-block H-vertical-middle H-font-size-15">返回</label></span>
        <div class="H-header-title H-center-all H-font-size-18 H-text-show-row-1 H-theme-font-color-white H-position-absolute H-width-100-percent">
          发货订单
        </div>
 
		 <div tapmode="" onclick="H.openWin('mytuihuohuan', 'mytuihuohuan.php');"  class="H-flex-item H-center-all H-theme-font-color-666 H-padding-vertical-both-10 H-theme-border-color-white  H-font-size-16" style="border-width: 0 0 2px  0">
               退货后退货
        </div>	 
    </header>
    <div id="lis" class="H-padding-8">
	
		  <?php

  	$reslut = "select count(*) as a from tbl_taospp where  ggunit='".$_COOKIE['userid']."'  and (goodstype=2 or goodstype=3)  and  and  id= (select goodid from tbl_taorder where is_pay=1 and is_refund=2 )";
  $query_reslut = mysql_query($reslut);
$row_reslut=mysql_fetch_array($query_reslut);
$count=$row_reslut['a'];
//页面数量
$page_size=10;
//总页数
$page_count = ceil($count/$page_size);
//第几页
$page=$_GET['page'];
if($page==''){
  $page=1;
}
$last=$page-1;//上一页
$next=$page+1;//下一页

//页面起始条数
$offset=$page_size*($page-1);
  
           $sql1 = "select t1.*,t2.ggunit,t2.img,t2.chtitle,t2.entitle from tbl_taorder t1 inner join tbl_taospp t2 on t1.goodid=t2.id  where t2.ggunit='".$_COOKIE['userid']."' and (t2.goodstype=2 or t2.goodstype=3  )and t1.is_pay=1 and t1.is_refund=2 group by t1.id";
           $query1 = mysql_query($sql1);
	
        if(!mysql_affected_rows()){
            echo '
                <div class="H-padding-vertical-bottom-10"></div>
                </br>
    <div class="H-channel-title H-flexbox-horizontal H-theme-background-color-white H-vertical-middle H-border-vertical-bottom-after">
        <div class="H-channel-line H-theme-background-color8 H-padding-vertical-top-15 H-padding-horizontal-left-3  H-margin-horizontal-left-10"></div>
        <div class="H-channel-text H-theme-font-color8 H-flex-item H-font-size-18 H-theme-font-color-black H-padding-10 H-margin-horizontal-right-10 H-text-show-row-1">空空如也</div>
    </div>
    </br></br>
            ';
}        
        while ($row=mysql_fetch_array($query1)) {
			
       $reslut2 = "select * from tbl_specifa where id='".$row['entitle']."'";
       $query_reslut2 = mysql_query($reslut2);
       $row_reslut2=mysql_fetch_array($query_reslut2);  
	$imgeve =explode(",", $row['img']);	   
    ?>
	
	
        <div id="list1" class="H-border-radius3-px H-theme-background-color-white H-margin-vertical-bottom-5 H-border-vertical-both-after H-border-horizontal-both-after">
            
            <div class="H-flexbox-horizontal H-theme-background-color-white H-border-vertical-bottom-after">
                <div class="H-padding-vertical-both-10">
                    <img src="<?=$imgeve[0]?>" srcs="" alt="" title="" class="imgCache H-display-block H-margin-horizontal-left-10" style="width: 60px; height: 60px;" />
                </div>
                <div class="H-flex-item H-padding-10">
                    <strong class="H-font-weight-normal font-weight-500 H-font-size-16 H-display-block H-text-show-row-1"><?=$row['chtitle']?></strong>
                    <div class="H-font-size-12 H-theme-font-color-999 H-text-show-row-1">
                       <?=$row_reslut2['spe_val']?>
                    </div>
                    
                </div>
           
            </div>
            
             
           <div style="height: 45px;">
                <button onclick="location='liaoliao.php?fid=<?=$row['uid']?>'" style="float: left;">联系买家</button>
               <div style="float: right;">
			   <!----------
                    <button>当面交易</button>
				-------------->	
                    <a href="#myPopup1" onclick="code(<?=$row['id']?>)" data-rel="popup" class="ui-btn ui-btn-inline ui-corner-all" data-position-to="window" style="width: 70px;">&nbsp;&nbsp;&nbsp;确认发货&nbsp;&nbsp;&nbsp;</a>
                </div>    
             </div>   
        </div>

       		<?php } ?> 
			
	            <?php

    if($page==1){   
	if($page_count>$page){
		
	echo "<a href='?page=".$next."'  style='text-decoration:none; width: 47px;border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;color: #fc8b4a;margin-left:43%;font-weight: 600;font-size: 14px;'>下一页</a>&nbsp;&nbsp;&nbsp;";	
	
	}
   }else
    if($page==$page_count){
      echo "&nbsp;&nbsp;<a href='?page=".$last."' style='text-decoration:none; border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;  font-size:15px; color: #fc8b4a; margin-left:40%;'>上一页</a>&nbsp;&nbsp;&nbsp;";
    }else{
      echo "&nbsp;&nbsp;<a href='?page=".$last."' style='text-decoration:none; width: 47px;border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;color: #fc8b4a;margin-left:30%;font-weight: 600;font-size: 14px;'>上一页</a>&nbsp;&nbsp;&nbsp;";
      echo "<a href='?page=".$next."' style='text-decoration:none; width: 47px;border: 1px solid;border-radius: 5px; border-style: -6px; padding: 5px;color: #fc8b4a;font-weight: 600;font-size: 14px;'>下一页</a>&nbsp;&nbsp;&nbsp;"; 
    }
  ?>
		
		
		
		
		

				
    </div> 
             

      
    <div data-role="popup" id="myPopup1" class="ui-content">
      <table class="table">
	    <tr ><td><input id="codeid" type="hidden"  type="text" /></td></tr>
	    <tr ><td><input id="kdname" type="hidden"  type="text" /></td></tr>
		
        <tr ><td>买家昵称：</td><td><input id="name" type="text" /></td></tr>
        <tr><td>买家号码：</td><td> <input id="tel" type="text" /></td></tr>
        <tr ><td>买家地址：</td><td><input id="address" type="text"/></td></tr>
        <tr ><td>物流单号：</td><td><input id="delivery_bn" type="text"/></td></tr>
        <tr ><td>物流公司：</td><td>
		<div class="div">  
    <a href="javascript:void(0)" class="select_a" date="#input_list,input">   
        <input type="text" class="select_input" value="请选择物流公司" />   
        
        <ul class="select_ul_list" id="input_list" readonly="readonly">   
            <li value="1">请选择物流公司</li>   
            <li value="zto">中通速递</li>   
            <li value="sto">申通速递</li>   
            <li value="yt">圆通速递</li>   
            <li value="yd">韵达速递</li>   
            <li value="sf">顺丰物流</li>   
            <li value="tt">天天物流</li>   
            <li value="ems">EMS</li>  			
        </ul>   
    </a>   
        </div>   
    </td></tr>
        <tr ><td colspan="2">
        <center><button onclick="go()" class="ui-btn ui-shadow ui-corner-all" style="font-size: 16px; font-weight: 400;">确认</button></center></td></tr>
      </table>
    </div>
    
	<script type="text/javascript">
	
    var ul = document.getElementById('input_list');
    var lis = ul.getElementsByTagName('li');
    for(var i=0;i<lis.length;i++){
    lis[i].onclick = function(){
    
	 $("#kdname").val(this.innerHTML);
       }
   }

	function code(a){
		var codeid=a;
		
		$("#codeid").val(codeid);
		
    $.ajax({
        url: './addressapi.php',
        type: 'POST',
        dataType: 'json',
        data: {codeid: codeid},
      })
      .done(function(respon) {
        if (respon.error==1) {
		$("#name").val(respon.name);
		$("#tel").val(respon.tel);
		$("#address").val(respon.address);		
		
		
	
      
        }else{
            
        
        }
      })

  }	
	

       function  go(){
	
		var codeid=$("#codeid").val();
		
		var delivery_bn=$("#delivery_bn").val();

		console.log(delivery_bn);		
		console.log(codeid);	


	  	
	var kddname=$("#kdname").val();
	var uid='<?=$_COOKIE['userid']?>';
   if(kddname==""){
	
	layer.open({
    content: '请选择物流公司'
    ,skin: 'msg'
    ,time: 2 
  });
	return false;
   }
   if(kddname=="天天物流"){
	kddid='tt';
   }	
   if(kddname=="顺丰物流"){
	kddid='sf';	
   }	
   if(kddname=="韵达速递"){
	kddid='yd';	
   }	
   if(kddname=="申通速递"){
	kddid='sto';	
   }	
   if(kddname=="圆通速递"){
	kddid='yt';	
   }	
   if(kddname=="中通速递"){
	kddid='zto';	
   }  
	   if(kddname=="EMS"){
	kddid='ems';	
   } 
console.log(kddid);
console.log(kddname);	
    $.ajax({
        url: '/api/muyin/api.php?s=xianzhi.save_delivery',
        type: 'POST',
        dataType: 'json',
        data: {
			uid: uid,
			order_id:codeid,
			delivery_bn:delivery_bn,
			delivery_com_name:kddname,
			delivery_com_id:kddid
		},
      })
      .done(function(respon) {
        if (respon.code==0) {
	
layer.open({
  content: '发货成功',
  btn: '我知道了',
  shadeClose: false,
  yes: function(){
   location.reload();
   layer.close(index);
  }
});
      
        }else{
            
        
        }
      })	
	
	
}
	
	
	
	
	</script>
</body>
</html>